package br.mikhas.container.annotation;

import java.lang.annotation.Annotation;

import br.mikhas.container.config.StandadBeanDefinition;
import br.mikhas.util.Assert;

/**
 * Holds the definition of an Annotated bean
 * 
 * @author Mikhail Domanoski
 * 
 */
public class AnnotatedBeanDefinition extends StandadBeanDefinition {

	/**
	 * The bean stereotype annotation
	 */
	private final Annotation annotation;

	AnnotatedBeanDefinition(Annotation ann, String name, Class<?> type,
			Class<?> instantiatingClass) {
		super(name, type, instantiatingClass);
		this.annotation = ann;
	}

	AnnotatedBeanDefinition(Annotation ann, String name, Class<?> type) {
		super(name, type);
		this.annotation = ann;
	}

	/**
	 * Gets the bean stereotype annotation
	 * 
	 * @return the bean annotation
	 */
	public Annotation getAnnotation() {
		return this.annotation;
	}

	/**
	 * Changes the name of the currenct definition
	 * 
	 * @param name
	 */
	public void setName(String name) {
		Assert.notEmpty(name);
		this.name = name;
	}

}
